version 12.1

**************      FIGURE A12 Average marginal component effects and average component interaction effects from separate linear regressions 
***** AMCE for each attribute, without interactions
use data.dta, clear
tab education
reg Y i.education pol_interest left_right gender age italian ftstudent lyceum edu_imp inc_imp hon_imp taxspend_imp samesex_imp survey, cl(IDContatto)
parmest, label norestore
drop in 4/17
save sim.dta, replace
use data.dta, clear
tab income
reg Y i.income pol_interest left_right gender age italian ftstudent lyceum edu_imp inc_imp hon_imp taxspend_imp samesex_imp survey, cl(IDContatto)
parmest, label norestore
drop in 4/17
save sim2.dta, replace
use sim.dta, clear
append using sim2.dta
save sim.dta, replace
use data.dta, clear
tab corruption
reg Y i.corruption pol_interest left_right gender age italian ftstudent lyceum edu_imp inc_imp hon_imp taxspend_imp samesex_imp survey, cl(IDContatto)
parmest, label norestore
drop in 4/17
save sim2.dta, replace
use sim.dta, clear
append using sim2.dta
save sim.dta, replace
use data.dta, clear
tab taxspend
reg Y i.taxspend pol_interest left_right gender age italian ftstudent lyceum edu_imp inc_imp hon_imp taxspend_imp samesex_imp survey, cl(IDContatto)
parmest, label norestore
drop in 4/17
save sim2.dta, replace
use sim.dta, clear
append using sim2.dta
save sim.dta, replace
use data.dta, clear
tab samesex
reg Y i.samesex pol_interest left_right gender age italian ftstudent lyceum edu_imp inc_imp hon_imp taxspend_imp samesex_imp survey, cl(IDContatto)
parmest, label norestore
drop in 4/17
save sim2.dta, replace
use sim.dta, clear
append using sim2.dta
save sim.dta, replace
sencode parm,gene(parmid)
save sim.dta, replace
eclplot estimate min95 max95 parmid in 1/15, estopts(msize(small)) rplottype(rspike) ciopts(msize(small)) graphregion(fcolor(white)) hor ysca(noline) xline(0, lpattern(dot) lcolor(black) lwidth(medthin)) ///
xlabel(-.5 "-0.5" -.4 "-0.4" -.3 "-0.3" -.2 "-0.2" -.1 "-0.1" 0 "0" .1 "0.1" .2 "0.2", noticks labsize(2)) xtitle("", size(2)) ytitle("") ///
text(0.5 -0.6 "{it:Education:}", place(c) just(center) size(2)) ///
text(3.5 -0.6 "{it:Income:}", place(c) just(center) size(2)) ///
text(6.5 -0.6 "{it:Integrity:}", place(c) just(center) size(2)) ///
text(9.5 -0.6 "{it:Tax and spend:}", place(c) just(center) size(2)) ///
text(12.5 -0.6 "{it:Same sex rights:}", place(c) just(center) size(2)) ///
ylabel(1 "Junior high school" 2 "High school" 3 "University" 4 "Low" 5 "Middle" 6 "High" ///
7 "Clean" 8 "Investigated" 9 "Corrupt" 10 "More" 11 "Constant" 12 "Less" 13 "Same" 14 "Some" 15 "None", noticks labsize(2)) ///
saving(ACME_noint, replace)

***** AMCE interaction EDUCATION * INCOME
use data.dta, clear
tab education income
reg Y i.education##i.income pol_interest left_right gender age italian ftstudent lyceum edu_imp inc_imp hon_imp taxspend_imp samesex_imp survey, cl(IDContatto)
matrix b=e(b)
matrix V=e(V)
scalar b2=b[1,2]
scalar b3=b[1,3]
scalar b5=b[1,5]
scalar b6=b[1,6]
scalar b11=b[1,11]
scalar b12=b[1,12]
scalar b14=b[1,14]
scalar b15=b[1,15]
scalar list b2 b3 b5 b6 b11 b12 b14 b15

scalar varb2=V[2,2]
scalar varb3=V[3,3]
scalar varb5=V[5,5]
scalar varb6=V[6,6]
scalar varb11=V[11,11]
scalar varb12=V[12,12]
scalar varb14=V[14,14]
scalar varb15=V[15,15]

scalar covb2b3=V[2,3]
scalar covb2b5=V[2,5]
scalar covb2b6=V[2,6]
scalar covb2b11=V[2,11]
scalar covb2b12=V[2,12]
scalar covb2b14=V[2,14]
scalar covb2b15=V[2,15]

scalar covb3b5=V[3,5]
scalar covb3b6=V[3,6]
scalar covb3b11=V[3,11]
scalar covb3b12=V[3,12]
scalar covb3b14=V[3,14]
scalar covb3b15=V[3,15]

scalar covb5b6=V[5,6]
scalar covb5b11=V[5,11]
scalar covb5b12=V[5,12]
scalar covb5b14=V[5,14]
scalar covb5b15=V[5,15]

scalar covb6b11=V[6,11]
scalar covb6b12=V[6,12]
scalar covb6b14=V[6,14]
scalar covb6b15=V[6,15]

scalar covb11b12=V[11,12]
scalar covb11b14=V[11,14]
scalar covb11b15=V[11,15]

scalar covb12b14=V[12,14]
scalar covb12b15=V[12,15]

scalar covb14b15=V[14,15]

scalar list varb2 varb3 varb5 varb6 varb11 varb12 varb14 varb15 covb2b3 covb2b5 covb2b6 covb2b11 covb2b12 covb2b14 covb2b15 ///
covb3b5 covb3b6 covb3b11 covb3b12 covb3b14 covb3b15 covb5b6 covb5b11 covb5b12 covb5b14 covb5b15 covb6b11 covb6b12 covb6b14 covb6b15 ///
covb11b12 covb11b14 covb11b15 covb12b14 covb12b15 covb14b15

parmest, label norestore

generate MVZ=_n
replace MVZ=. if _n>12
* Note:   xxxnyyyn : impact of xxxn at yyyn
* edu2inc1 in 1
gen beta=b2 in 1
gen ci_l = beta - 1.96*sqrt(varb2) in 1
gen ci_h = beta + 1.96*sqrt(varb2) in 1
* edu3inc1 in 2
replace beta=b3 in 2 
replace ci_l = beta - 1.96*sqrt(varb3) in 2
replace ci_h = beta + 1.96*sqrt(varb3) in 2
* edu2inc2 in 3
replace beta=b2 + b11 in 3
replace ci_l = beta - 1.96*sqrt(varb2 + varb11 + 2*covb2b11) in 3
replace ci_h = beta + 1.96*sqrt(varb2 + varb11 + 2*covb2b11) in 3
* edu3inc2 in 4
replace beta=b3 + b14 in 4
replace ci_l = beta - 1.96*sqrt(varb3 + varb14 + 2*covb3b14) in 4
replace ci_h = beta + 1.96*sqrt(varb3 + varb14 + 2*covb3b14) in 4
* edu2inc3 in 5
replace beta=b2 + b12 in 5
replace ci_l = beta - 1.96*sqrt(varb2 + varb12 + 2*covb2b12) in 5
replace ci_h = beta + 1.96*sqrt(varb2 + varb12 + 2*covb2b12) in 5
* edu3inc3 in 6
replace beta=b3 + b15 in 6
replace ci_l = beta - 1.96*sqrt(varb3 + varb15 + 2*covb3b15) in 6
replace ci_h = beta + 1.96*sqrt(varb3 + varb15 + 2*covb3b15) in 6
* inc2edu1 in 7
replace beta=b5 in 7
replace ci_l = beta - 1.96*sqrt(varb5) in 7
replace ci_h = beta + 1.96*sqrt(varb5) in 7
* inc3edu1 in 8
replace beta=b6 in 8 
replace ci_l = beta - 1.96*sqrt(varb6) in 8
replace ci_h = beta + 1.96*sqrt(varb6) in 8
* inc2edu2 in 9
replace beta=b5 + b11 in 9
replace ci_l = beta - 1.96*sqrt(varb5 + varb11 + 2*covb5b11) in 9
replace ci_h = beta + 1.96*sqrt(varb5 + varb11 + 2*covb5b11) in 9
* inc3edu2 in 10
replace beta=b6 + b12 in 10
replace ci_l = beta - 1.96*sqrt(varb6 + varb12 + 2*covb6b12) in 10
replace ci_h = beta + 1.96*sqrt(varb6 + varb12 + 2*covb6b12) in 10
* inc2edu3 in 11
replace beta=b5 + b14 in 11
replace ci_l = beta - 1.96*sqrt(varb5 + varb14 + 2*covb5b14) in 11
replace ci_h = beta + 1.96*sqrt(varb5 + varb14 + 2*covb5b14) in 11
* inc3edu3 in 12
replace beta=b6 + b15 in 12
replace ci_l = beta - 1.96*sqrt(varb6 + varb15 + 2*covb6b15) in 12
replace ci_h = beta + 1.96*sqrt(varb6 + varb15 + 2*covb6b15) in 12

eclplot beta ci_l ci_h MVZ in 1/12, estopts(msize(small)) rplottype(rspike) ciopts(msize(small)) graphregion(fcolor(white)) hor ysca(noline) xline(0, lpattern(dot) lcolor(black) lwidth(medthin)) ///
xlabel(-.2 "-0.2" -.1 "-0.1" 0 "0" .1 "0.1" .2 "0.2" .3 "0.3", noticks labsize(2)) xtitle("", size(2)) ytitle("") ///
text(0.5 0 "{it:Low income}", place(c) just(center) size(2)) ///
text(2.5 0 "{it:Middle income}", place(c) just(center) size(2)) ///
text(4.5 0 "{it:High income}", place(c) just(center) size(2)) ///
text(6.5 0 "{it:Junior high school}", place(c) just(center) size(2)) ///
text(8.5 0 "{it:High school}", place(c) just(center) size(2)) ///
text(10.5 0 "{it:University}", place(c) just(center) size(2)) ///
ylabel(1 "High school" 2 "University" 3 "High school" 4 "University" 5 "High school" 6 "University" ///
7 "Middle income" 8 "High income" 9 "Middle income" 10 "High income" 11 "Middle income" 12 "High income", noticks labsize(2)) ///
 saving(ACME_eduinc, replace)


***** AMCE interaction EDUCATION * CORRUPTION
use data.dta, clear
tab education corruption
reg Y i.education##i.corruption pol_interest left_right gender age italian ftstudent lyceum edu_imp inc_imp hon_imp taxspend_imp samesex_imp survey, cl(IDContatto)
matrix b=e(b)
matrix V=e(V)
scalar b2=b[1,2]
scalar b3=b[1,3]
scalar b5=b[1,5]
scalar b6=b[1,6]
scalar b11=b[1,11]
scalar b12=b[1,12]
scalar b14=b[1,14]
scalar b15=b[1,15]
scalar list b2 b3 b5 b6 b11 b12 b14 b15

scalar varb2=V[2,2]
scalar varb3=V[3,3]
scalar varb5=V[5,5]
scalar varb6=V[6,6]
scalar varb11=V[11,11]
scalar varb12=V[12,12]
scalar varb14=V[14,14]
scalar varb15=V[15,15]

scalar covb2b3=V[2,3]
scalar covb2b5=V[2,5]
scalar covb2b6=V[2,6]
scalar covb2b11=V[2,11]
scalar covb2b12=V[2,12]
scalar covb2b14=V[2,14]
scalar covb2b15=V[2,15]

scalar covb3b5=V[3,5]
scalar covb3b6=V[3,6]
scalar covb3b11=V[3,11]
scalar covb3b12=V[3,12]
scalar covb3b14=V[3,14]
scalar covb3b15=V[3,15]

scalar covb5b6=V[5,6]
scalar covb5b11=V[5,11]
scalar covb5b12=V[5,12]
scalar covb5b14=V[5,14]
scalar covb5b15=V[5,15]

scalar covb6b11=V[6,11]
scalar covb6b12=V[6,12]
scalar covb6b14=V[6,14]
scalar covb6b15=V[6,15]

scalar covb11b12=V[11,12]
scalar covb11b14=V[11,14]
scalar covb11b15=V[11,15]

scalar covb12b14=V[12,14]
scalar covb12b15=V[12,15]

scalar covb14b15=V[14,15]

scalar list varb2 varb3 varb5 varb6 varb11 varb12 varb14 varb15 covb2b3 covb2b5 covb2b6 covb2b11 covb2b12 covb2b14 covb2b15 ///
covb3b5 covb3b6 covb3b11 covb3b12 covb3b14 covb3b15 covb5b6 covb5b11 covb5b12 covb5b14 covb5b15 covb6b11 covb6b12 covb6b14 covb6b15 ///
covb11b12 covb11b14 covb11b15 covb12b14 covb12b15 covb14b15

parmest, label norestore

generate MVZ=_n
replace MVZ=. if _n>12

* edu2corr1 in 1
gen beta=b2 in 1
gen ci_l = beta - 1.96*sqrt(varb2) in 1
gen ci_h = beta + 1.96*sqrt(varb2) in 1
* edu3corr1 in 2
replace beta=b3 in 2 
replace ci_l = beta - 1.96*sqrt(varb3) in 2
replace ci_h = beta + 1.96*sqrt(varb3) in 2
* edu2corr2 in 3
replace beta=b2 + b11 in 3
replace ci_l = beta - 1.96*sqrt(varb2 + varb11 + 2*covb2b11) in 3
replace ci_h = beta + 1.96*sqrt(varb2 + varb11 + 2*covb2b11) in 3
* edu3corr2 in 4
replace beta=b3 + b14 in 4
replace ci_l = beta - 1.96*sqrt(varb3 + varb14 + 2*covb3b14) in 4
replace ci_h = beta + 1.96*sqrt(varb3 + varb14 + 2*covb3b14) in 4
* edu2corr3 in 5
replace beta=b2 + b12 in 5
replace ci_l = beta - 1.96*sqrt(varb2 + varb12 + 2*covb2b12) in 5
replace ci_h = beta + 1.96*sqrt(varb2 + varb12 + 2*covb2b12) in 5
* edu3corr3 in 6
replace beta=b3 + b15 in 6
replace ci_l = beta - 1.96*sqrt(varb3 + varb15 + 2*covb3b15) in 6
replace ci_h = beta + 1.96*sqrt(varb3 + varb15 + 2*covb3b15) in 6
* corr2edu1 in 7
replace beta=b5 in 7
replace ci_l = beta - 1.96*sqrt(varb5) in 7
replace ci_h = beta + 1.96*sqrt(varb5) in 7
* corr3edu1 in 8
replace beta=b6 in 8 
replace ci_l = beta - 1.96*sqrt(varb6) in 8
replace ci_h = beta + 1.96*sqrt(varb6) in 8
* corr2edu2 in 9
replace beta=b5 + b11 in 9
replace ci_l = beta - 1.96*sqrt(varb5 + varb11 + 2*covb5b11) in 9
replace ci_h = beta + 1.96*sqrt(varb5 + varb11 + 2*covb5b11) in 9
* corr3edu2 in 10
replace beta=b6 + b12 in 10
replace ci_l = beta - 1.96*sqrt(varb6 + varb12 + 2*covb6b12) in 10
replace ci_h = beta + 1.96*sqrt(varb6 + varb12 + 2*covb6b12) in 10
* corr2edu3 in 11
replace beta=b5 + b14 in 11
replace ci_l = beta - 1.96*sqrt(varb5 + varb14 + 2*covb5b14) in 11
replace ci_h = beta + 1.96*sqrt(varb5 + varb14 + 2*covb5b14) in 11
* corr3edu3 in 12
replace beta=b6 + b15 in 12
replace ci_l = beta - 1.96*sqrt(varb6 + varb15 + 2*covb6b15) in 12
replace ci_h = beta + 1.96*sqrt(varb6 + varb15 + 2*covb6b15) in 12

eclplot beta ci_l ci_h MVZ in 1/12, estopts(msize(small)) rplottype(rspike) ciopts(msize(small)) graphregion(fcolor(white)) hor ysca(noline) xline(0, lpattern(dot) lcolor(black) lwidth(medthin)) ///
xlabel(-.5 "-0.5" -.4 "-0.4" -.3 "-0.3" -.2 "-0.2" -.1 "-0.1" 0 "0" .1 "0.1" .2 "0.2", noticks labsize(2)) xtitle("", size(2)) ytitle("") ///
text(0.5 0 "{it:Clean}", place(c) just(center) size(2)) ///
text(2.5 0 "{it:Investigated}", place(c) just(center) size(2)) ///
text(4.5 0 "{it:Corrupt}", place(c) just(center) size(2)) ///
text(6.5 0 "{it:Junior high school}", place(c) just(center) size(2)) ///
text(8.5 0 "{it:High school}", place(c) just(center) size(2)) ///
text(10.5 0 "{it:University}", place(c) just(center) size(2)) ///
ylabel(1 "High school" 2 "University" 3 "High school" 4 "University" 5 "High school" 6 "University" ///
7 "Investigated" 8 "Corrupt" 9 "Investigated" 10 "Corrupt" 11 "Investigated" 12 "Corrupt", noticks labsize(2)) ///
 saving(ACME_educorr, replace)


***** AMCE interaction EDUCATION * TAXSPEND
use data.dta, clear
tab education taxspend
reg Y i.education##i.taxspend pol_interest left_right gender age italian ftstudent lyceum edu_imp inc_imp hon_imp taxspend_imp samesex_imp survey, cl(IDContatto)
matrix b=e(b)
matrix V=e(V)
scalar b2=b[1,2]
scalar b3=b[1,3]
scalar b5=b[1,5]
scalar b6=b[1,6]
scalar b11=b[1,11]
scalar b12=b[1,12]
scalar b14=b[1,14]
scalar b15=b[1,15]
scalar list b2 b3 b5 b6 b11 b12 b14 b15

scalar varb2=V[2,2]
scalar varb3=V[3,3]
scalar varb5=V[5,5]
scalar varb6=V[6,6]
scalar varb11=V[11,11]
scalar varb12=V[12,12]
scalar varb14=V[14,14]
scalar varb15=V[15,15]

scalar covb2b3=V[2,3]
scalar covb2b5=V[2,5]
scalar covb2b6=V[2,6]
scalar covb2b11=V[2,11]
scalar covb2b12=V[2,12]
scalar covb2b14=V[2,14]
scalar covb2b15=V[2,15]

scalar covb3b5=V[3,5]
scalar covb3b6=V[3,6]
scalar covb3b11=V[3,11]
scalar covb3b12=V[3,12]
scalar covb3b14=V[3,14]
scalar covb3b15=V[3,15]

scalar covb5b6=V[5,6]
scalar covb5b11=V[5,11]
scalar covb5b12=V[5,12]
scalar covb5b14=V[5,14]
scalar covb5b15=V[5,15]

scalar covb6b11=V[6,11]
scalar covb6b12=V[6,12]
scalar covb6b14=V[6,14]
scalar covb6b15=V[6,15]

scalar covb11b12=V[11,12]
scalar covb11b14=V[11,14]
scalar covb11b15=V[11,15]

scalar covb12b14=V[12,14]
scalar covb12b15=V[12,15]

scalar covb14b15=V[14,15]

scalar list varb2 varb3 varb5 varb6 varb11 varb12 varb14 varb15 covb2b3 covb2b5 covb2b6 covb2b11 covb2b12 covb2b14 covb2b15 ///
covb3b5 covb3b6 covb3b11 covb3b12 covb3b14 covb3b15 covb5b6 covb5b11 covb5b12 covb5b14 covb5b15 covb6b11 covb6b12 covb6b14 covb6b15 ///
covb11b12 covb11b14 covb11b15 covb12b14 covb12b15 covb14b15

parmest, label norestore

generate MVZ=_n
replace MVZ=. if _n>12

* edu2tax1 in 1
gen beta=b2 in 1
gen ci_l = beta - 1.96*sqrt(varb2) in 1
gen ci_h = beta + 1.96*sqrt(varb2) in 1
* edu3tax1 in 2
replace beta=b3 in 2 
replace ci_l = beta - 1.96*sqrt(varb3) in 2
replace ci_h = beta + 1.96*sqrt(varb3) in 2
* edu2tax2 in 3
replace beta=b2 + b11 in 3
replace ci_l = beta - 1.96*sqrt(varb2 + varb11 + 2*covb2b11) in 3
replace ci_h = beta + 1.96*sqrt(varb2 + varb11 + 2*covb2b11) in 3
* edu3tax2 in 4
replace beta=b3 + b14 in 4
replace ci_l = beta - 1.96*sqrt(varb3 + varb14 + 2*covb3b14) in 4
replace ci_h = beta + 1.96*sqrt(varb3 + varb14 + 2*covb3b14) in 4
* edu2tax3 in 5
replace beta=b2 + b12 in 5
replace ci_l = beta - 1.96*sqrt(varb2 + varb12 + 2*covb2b12) in 5
replace ci_h = beta + 1.96*sqrt(varb2 + varb12 + 2*covb2b12) in 5
* edu3tax3 in 6
replace beta=b3 + b15 in 6
replace ci_l = beta - 1.96*sqrt(varb3 + varb15 + 2*covb3b15) in 6
replace ci_h = beta + 1.96*sqrt(varb3 + varb15 + 2*covb3b15) in 6
* tax2edu1 in 7
replace beta=b5 in 7
replace ci_l = beta - 1.96*sqrt(varb5) in 7
replace ci_h = beta + 1.96*sqrt(varb5) in 7
* tax3edu1 in 8
replace beta=b6 in 8 
replace ci_l = beta - 1.96*sqrt(varb6) in 8
replace ci_h = beta + 1.96*sqrt(varb6) in 8
* tax2edu2 in 9
replace beta=b5 + b11 in 9
replace ci_l = beta - 1.96*sqrt(varb5 + varb11 + 2*covb5b11) in 9
replace ci_h = beta + 1.96*sqrt(varb5 + varb11 + 2*covb5b11) in 9
* tax3edu2 in 10
replace beta=b6 + b12 in 10
replace ci_l = beta - 1.96*sqrt(varb6 + varb12 + 2*covb6b12) in 10
replace ci_h = beta + 1.96*sqrt(varb6 + varb12 + 2*covb6b12) in 10
* tax2edu3 in 11
replace beta=b5 + b14 in 11
replace ci_l = beta - 1.96*sqrt(varb5 + varb14 + 2*covb5b14) in 11
replace ci_h = beta + 1.96*sqrt(varb5 + varb14 + 2*covb5b14) in 11
* tax3edu3 in 12
replace beta=b6 + b15 in 12
replace ci_l = beta - 1.96*sqrt(varb6 + varb15 + 2*covb6b15) in 12
replace ci_h = beta + 1.96*sqrt(varb6 + varb15 + 2*covb6b15) in 12

eclplot beta ci_l ci_h MVZ in 1/12, estopts(msize(small)) rplottype(rspike) ciopts(msize(small)) graphregion(fcolor(white)) hor ysca(noline) xline(0, lpattern(dot) lcolor(black) lwidth(medthin)) ///
xlabel(-.3 "-0.3" -.2 "-0.2" -.1 "-0.1" 0 "0" .1 "0.1" .2 "0.2" .3 "0.3", noticks labsize(2)) xtitle("", size(2)) ytitle("") ///
text(0.5 0 "{it:More tax and spend}", place(c) just(center) size(2)) ///
text(2.5 0 "{it:Constant tax and spend}", place(c) just(center) size(2)) ///
text(4.5 0 "{it:Less tax and spend}", place(c) just(center) size(2)) ///
text(6.5 0 "{it:Junior high school}", place(c) just(center) size(2)) ///
text(8.5 0 "{it:High school}", place(c) just(center) size(2)) ///
text(10.5 0 "{it:University}", place(c) just(center) size(2)) ///
ylabel(1 "High school" 2 "University" 3 "High school" 4 "University" 5 "High school" 6 "University" ///
7 "Constant tax-spend" 8 "Less tax-spend" 9 "Constant tax-spend" 10 "Less tax-spend" 11 "Constant tax-spend" 12 "Less tax-spend", noticks labsize(2)) ///
 saving(ACME_edutax, replace)


***** AMCE interaction EDUCATION * SAMESEX
use data.dta, clear
tab education samesex
reg Y i.education##i.samesex pol_interest left_right gender age italian ftstudent lyceum edu_imp inc_imp hon_imp taxspend_imp samesex_imp survey, cl(IDContatto)
matrix b=e(b)
matrix V=e(V)
scalar b2=b[1,2]
scalar b3=b[1,3]
scalar b5=b[1,5]
scalar b6=b[1,6]
scalar b11=b[1,11]
scalar b12=b[1,12]
scalar b14=b[1,14]
scalar b15=b[1,15]
scalar list b2 b3 b5 b6 b11 b12 b14 b15

scalar varb2=V[2,2]
scalar varb3=V[3,3]
scalar varb5=V[5,5]
scalar varb6=V[6,6]
scalar varb11=V[11,11]
scalar varb12=V[12,12]
scalar varb14=V[14,14]
scalar varb15=V[15,15]

scalar covb2b3=V[2,3]
scalar covb2b5=V[2,5]
scalar covb2b6=V[2,6]
scalar covb2b11=V[2,11]
scalar covb2b12=V[2,12]
scalar covb2b14=V[2,14]
scalar covb2b15=V[2,15]

scalar covb3b5=V[3,5]
scalar covb3b6=V[3,6]
scalar covb3b11=V[3,11]
scalar covb3b12=V[3,12]
scalar covb3b14=V[3,14]
scalar covb3b15=V[3,15]

scalar covb5b6=V[5,6]
scalar covb5b11=V[5,11]
scalar covb5b12=V[5,12]
scalar covb5b14=V[5,14]
scalar covb5b15=V[5,15]

scalar covb6b11=V[6,11]
scalar covb6b12=V[6,12]
scalar covb6b14=V[6,14]
scalar covb6b15=V[6,15]

scalar covb11b12=V[11,12]
scalar covb11b14=V[11,14]
scalar covb11b15=V[11,15]

scalar covb12b14=V[12,14]
scalar covb12b15=V[12,15]

scalar covb14b15=V[14,15]

scalar list varb2 varb3 varb5 varb6 varb11 varb12 varb14 varb15 covb2b3 covb2b5 covb2b6 covb2b11 covb2b12 covb2b14 covb2b15 ///
covb3b5 covb3b6 covb3b11 covb3b12 covb3b14 covb3b15 covb5b6 covb5b11 covb5b12 covb5b14 covb5b15 covb6b11 covb6b12 covb6b14 covb6b15 ///
covb11b12 covb11b14 covb11b15 covb12b14 covb12b15 covb14b15

parmest, label norestore

generate MVZ=_n
replace MVZ=. if _n>12

* edu2ssex1 in 1
gen beta=b2 in 1
gen ci_l = beta - 1.96*sqrt(varb2) in 1
gen ci_h = beta + 1.96*sqrt(varb2) in 1
* edu3ssex1 in 2
replace beta=b3 in 2 
replace ci_l = beta - 1.96*sqrt(varb3) in 2
replace ci_h = beta + 1.96*sqrt(varb3) in 2
* edu2ssex2 in 3
replace beta=b2 + b11 in 3
replace ci_l = beta - 1.96*sqrt(varb2 + varb11 + 2*covb2b11) in 3
replace ci_h = beta + 1.96*sqrt(varb2 + varb11 + 2*covb2b11) in 3
* edu3ssex2 in 4
replace beta=b3 + b14 in 4
replace ci_l = beta - 1.96*sqrt(varb3 + varb14 + 2*covb3b14) in 4
replace ci_h = beta + 1.96*sqrt(varb3 + varb14 + 2*covb3b14) in 4
* edu2ssex3 in 5
replace beta=b2 + b12 in 5
replace ci_l = beta - 1.96*sqrt(varb2 + varb12 + 2*covb2b12) in 5
replace ci_h = beta + 1.96*sqrt(varb2 + varb12 + 2*covb2b12) in 5
* edu3ssex3 in 6
replace beta=b3 + b15 in 6
replace ci_l = beta - 1.96*sqrt(varb3 + varb15 + 2*covb3b15) in 6
replace ci_h = beta + 1.96*sqrt(varb3 + varb15 + 2*covb3b15) in 6
* ssex2edu1 in 7
replace beta=b5 in 7
replace ci_l = beta - 1.96*sqrt(varb5) in 7
replace ci_h = beta + 1.96*sqrt(varb5) in 7
* ssex3edu1 in 8
replace beta=b6 in 8 
replace ci_l = beta - 1.96*sqrt(varb6) in 8
replace ci_h = beta + 1.96*sqrt(varb6) in 8
* ssex2edu2 in 9
replace beta=b5 + b11 in 9
replace ci_l = beta - 1.96*sqrt(varb5 + varb11 + 2*covb5b11) in 9
replace ci_h = beta + 1.96*sqrt(varb5 + varb11 + 2*covb5b11) in 9
* ssex3edu2 in 10
replace beta=b6 + b12 in 10
replace ci_l = beta - 1.96*sqrt(varb6 + varb12 + 2*covb6b12) in 10
replace ci_h = beta + 1.96*sqrt(varb6 + varb12 + 2*covb6b12) in 10
* ssex2edu3 in 11
replace beta=b5 + b14 in 11
replace ci_l = beta - 1.96*sqrt(varb5 + varb14 + 2*covb5b14) in 11
replace ci_h = beta + 1.96*sqrt(varb5 + varb14 + 2*covb5b14) in 11
* ssex3edu3 in 12
replace beta=b6 + b15 in 12
replace ci_l = beta - 1.96*sqrt(varb6 + varb15 + 2*covb6b15) in 12
replace ci_h = beta + 1.96*sqrt(varb6 + varb15 + 2*covb6b15) in 12

eclplot beta ci_l ci_h MVZ in 1/12, estopts(msize(small)) rplottype(rspike) ciopts(msize(small)) graphregion(fcolor(white)) hor ysca(noline) xline(0, lpattern(dot) lcolor(black) lwidth(medthin)) ///
xlabel(-.2 "-0.2" -.1 "-0.1" 0 "0" .1 "0.1" .2 "0.2" .3 "0.3", noticks labsize(2)) xtitle("", size(2)) ytitle("") ///
text(0.5 0 "{it:Same rights}", place(c) just(center) size(2)) ///
text(2.5 0 "{it:Some rights}", place(c) just(center) size(2)) ///
text(4.5 0 "{it:No rights}", place(c) just(center) size(2)) ///
text(6.5 0 "{it:Junior high school}", place(c) just(center) size(2)) ///
text(8.5 0 "{it:High school}", place(c) just(center) size(2)) ///
text(10.5 0 "{it:University}", place(c) just(center) size(2)) ///
ylabel(1 "High school" 2 "University" 3 "High school" 4 "University" 5 "High school" 6 "University" ///
7 "Some rights" 8 "No rights" 9 "Some rights" 10 "No rights" 11 "Some rights" 12 "No rights", noticks labsize(2)) ///
 saving(ACME_edussex, replace)


***** AMCE interaction INCOME * CORRUPTION
use data.dta, clear
tab income corruption
reg Y i.income##i.corruption pol_interest left_right gender age italian ftstudent lyceum edu_imp inc_imp hon_imp taxspend_imp samesex_imp survey, cl(IDContatto)
matrix b=e(b)
matrix V=e(V)
scalar b2=b[1,2]
scalar b3=b[1,3]
scalar b5=b[1,5]
scalar b6=b[1,6]
scalar b11=b[1,11]
scalar b12=b[1,12]
scalar b14=b[1,14]
scalar b15=b[1,15]
scalar list b2 b3 b5 b6 b11 b12 b14 b15

scalar varb2=V[2,2]
scalar varb3=V[3,3]
scalar varb5=V[5,5]
scalar varb6=V[6,6]
scalar varb11=V[11,11]
scalar varb12=V[12,12]
scalar varb14=V[14,14]
scalar varb15=V[15,15]

scalar covb2b3=V[2,3]
scalar covb2b5=V[2,5]
scalar covb2b6=V[2,6]
scalar covb2b11=V[2,11]
scalar covb2b12=V[2,12]
scalar covb2b14=V[2,14]
scalar covb2b15=V[2,15]

scalar covb3b5=V[3,5]
scalar covb3b6=V[3,6]
scalar covb3b11=V[3,11]
scalar covb3b12=V[3,12]
scalar covb3b14=V[3,14]
scalar covb3b15=V[3,15]

scalar covb5b6=V[5,6]
scalar covb5b11=V[5,11]
scalar covb5b12=V[5,12]
scalar covb5b14=V[5,14]
scalar covb5b15=V[5,15]

scalar covb6b11=V[6,11]
scalar covb6b12=V[6,12]
scalar covb6b14=V[6,14]
scalar covb6b15=V[6,15]

scalar covb11b12=V[11,12]
scalar covb11b14=V[11,14]
scalar covb11b15=V[11,15]

scalar covb12b14=V[12,14]
scalar covb12b15=V[12,15]

scalar covb14b15=V[14,15]

scalar list varb2 varb3 varb5 varb6 varb11 varb12 varb14 varb15 covb2b3 covb2b5 covb2b6 covb2b11 covb2b12 covb2b14 covb2b15 ///
covb3b5 covb3b6 covb3b11 covb3b12 covb3b14 covb3b15 covb5b6 covb5b11 covb5b12 covb5b14 covb5b15 covb6b11 covb6b12 covb6b14 covb6b15 ///
covb11b12 covb11b14 covb11b15 covb12b14 covb12b15 covb14b15

parmest, label norestore

generate MVZ=_n
replace MVZ=. if _n>12

* inc2corr1 in 1
gen beta=b2 in 1
gen ci_l = beta - 1.96*sqrt(varb2) in 1
gen ci_h = beta + 1.96*sqrt(varb2) in 1
* inc3corr1 in 2
replace beta=b3 in 2 
replace ci_l = beta - 1.96*sqrt(varb3) in 2
replace ci_h = beta + 1.96*sqrt(varb3) in 2
* inc2corr2 in 3
replace beta=b2 + b11 in 3
replace ci_l = beta - 1.96*sqrt(varb2 + varb11 + 2*covb2b11) in 3
replace ci_h = beta + 1.96*sqrt(varb2 + varb11 + 2*covb2b11) in 3
* inc3corr2 in 4
replace beta=b3 + b14 in 4
replace ci_l = beta - 1.96*sqrt(varb3 + varb14 + 2*covb3b14) in 4
replace ci_h = beta + 1.96*sqrt(varb3 + varb14 + 2*covb3b14) in 4
* inc2corr3 in 5
replace beta=b2 + b12 in 5
replace ci_l = beta - 1.96*sqrt(varb2 + varb12 + 2*covb2b12) in 5
replace ci_h = beta + 1.96*sqrt(varb2 + varb12 + 2*covb2b12) in 5
* inc3corr3 in 6
replace beta=b3 + b15 in 6
replace ci_l = beta - 1.96*sqrt(varb3 + varb15 + 2*covb3b15) in 6
replace ci_h = beta + 1.96*sqrt(varb3 + varb15 + 2*covb3b15) in 6
* corr2inc1 in 7
replace beta=b5 in 7
replace ci_l = beta - 1.96*sqrt(varb5) in 7
replace ci_h = beta + 1.96*sqrt(varb5) in 7
* corr3inc1 in 8
replace beta=b6 in 8 
replace ci_l = beta - 1.96*sqrt(varb6) in 8
replace ci_h = beta + 1.96*sqrt(varb6) in 8
* corr2inc2 in 9
replace beta=b5 + b11 in 9
replace ci_l = beta - 1.96*sqrt(varb5 + varb11 + 2*covb5b11) in 9
replace ci_h = beta + 1.96*sqrt(varb5 + varb11 + 2*covb5b11) in 9
* corr3inc2 in 10
replace beta=b6 + b12 in 10
replace ci_l = beta - 1.96*sqrt(varb6 + varb12 + 2*covb6b12) in 10
replace ci_h = beta + 1.96*sqrt(varb6 + varb12 + 2*covb6b12) in 10
* corr2inc3 in 11
replace beta=b5 + b14 in 11
replace ci_l = beta - 1.96*sqrt(varb5 + varb14 + 2*covb5b14) in 11
replace ci_h = beta + 1.96*sqrt(varb5 + varb14 + 2*covb5b14) in 11
* corr3inc3 in 12
replace beta=b6 + b15 in 12
replace ci_l = beta - 1.96*sqrt(varb6 + varb15 + 2*covb6b15) in 12
replace ci_h = beta + 1.96*sqrt(varb6 + varb15 + 2*covb6b15) in 12

eclplot beta ci_l ci_h MVZ in 1/12, estopts(msize(small)) rplottype(rspike) ciopts(msize(small)) graphregion(fcolor(white)) hor ysca(noline) xline(0, lpattern(dot) lcolor(black) lwidth(medthin)) ///
xlabel(-.7 "-0.7" -.6 "-0.6" -.5 "-0.5" -.4 "-0.4" -.3 "-0.3" -.2 "-0.2" -.1 "-0.1" 0 "0" .1 "0.1" .2 "0.2", noticks labsize(2)) xtitle("", size(2)) ytitle("") ///
text(0.5 0 "{it:Clean}", place(c) just(center) size(2)) ///
text(2.5 0 "{it:Investigated}", place(c) just(center) size(2)) ///
text(4.5 0 "{it:Corrupt}", place(c) just(center) size(2)) ///
text(6.5 0 "{it:Low income}", place(c) just(center) size(2)) ///
text(8.5 0 "{it:Middle income}", place(c) just(center) size(2)) ///
text(10.5 0 "{it:High income}", place(c) just(center) size(2)) ///
ylabel(1 "Middle income" 2 "High income" 3 "Middle income" 4 "High income" 5 "Middle income" 6 "High income" ///
7 "Investigated" 8 "Corrupt" 9 "Investigated" 10 "Corrupt" 11 "Investigated" 12 "Corrupt", noticks labsize(2)) ///
 saving(ACME_inccorr, replace)


***** AMCE interaction INCOME * TAXSPEND
use data.dta, clear
tab income taxspend
reg Y i.income##i.taxspend pol_interest left_right gender age italian ftstudent lyceum edu_imp inc_imp hon_imp taxspend_imp samesex_imp survey, cl(IDContatto)
matrix b=e(b)
matrix V=e(V)
scalar b2=b[1,2]
scalar b3=b[1,3]
scalar b5=b[1,5]
scalar b6=b[1,6]
scalar b11=b[1,11]
scalar b12=b[1,12]
scalar b14=b[1,14]
scalar b15=b[1,15]
scalar list b2 b3 b5 b6 b11 b12 b14 b15

scalar varb2=V[2,2]
scalar varb3=V[3,3]
scalar varb5=V[5,5]
scalar varb6=V[6,6]
scalar varb11=V[11,11]
scalar varb12=V[12,12]
scalar varb14=V[14,14]
scalar varb15=V[15,15]

scalar covb2b3=V[2,3]
scalar covb2b5=V[2,5]
scalar covb2b6=V[2,6]
scalar covb2b11=V[2,11]
scalar covb2b12=V[2,12]
scalar covb2b14=V[2,14]
scalar covb2b15=V[2,15]

scalar covb3b5=V[3,5]
scalar covb3b6=V[3,6]
scalar covb3b11=V[3,11]
scalar covb3b12=V[3,12]
scalar covb3b14=V[3,14]
scalar covb3b15=V[3,15]

scalar covb5b6=V[5,6]
scalar covb5b11=V[5,11]
scalar covb5b12=V[5,12]
scalar covb5b14=V[5,14]
scalar covb5b15=V[5,15]

scalar covb6b11=V[6,11]
scalar covb6b12=V[6,12]
scalar covb6b14=V[6,14]
scalar covb6b15=V[6,15]

scalar covb11b12=V[11,12]
scalar covb11b14=V[11,14]
scalar covb11b15=V[11,15]

scalar covb12b14=V[12,14]
scalar covb12b15=V[12,15]

scalar covb14b15=V[14,15]

scalar list varb2 varb3 varb5 varb6 varb11 varb12 varb14 varb15 covb2b3 covb2b5 covb2b6 covb2b11 covb2b12 covb2b14 covb2b15 ///
covb3b5 covb3b6 covb3b11 covb3b12 covb3b14 covb3b15 covb5b6 covb5b11 covb5b12 covb5b14 covb5b15 covb6b11 covb6b12 covb6b14 covb6b15 ///
covb11b12 covb11b14 covb11b15 covb12b14 covb12b15 covb14b15

parmest, label norestore

generate MVZ=_n
replace MVZ=. if _n>12

* inc2tax1 in 1
gen beta=b2 in 1
gen ci_l = beta - 1.96*sqrt(varb2) in 1
gen ci_h = beta + 1.96*sqrt(varb2) in 1
* inc3tax1 in 2
replace beta=b3 in 2 
replace ci_l = beta - 1.96*sqrt(varb3) in 2
replace ci_h = beta + 1.96*sqrt(varb3) in 2
* inc2tax2 in 3
replace beta=b2 + b11 in 3
replace ci_l = beta - 1.96*sqrt(varb2 + varb11 + 2*covb2b11) in 3
replace ci_h = beta + 1.96*sqrt(varb2 + varb11 + 2*covb2b11) in 3
* inc3tax2 in 4
replace beta=b3 + b14 in 4
replace ci_l = beta - 1.96*sqrt(varb3 + varb14 + 2*covb3b14) in 4
replace ci_h = beta + 1.96*sqrt(varb3 + varb14 + 2*covb3b14) in 4
* inc2tax3 in 5
replace beta=b2 + b12 in 5
replace ci_l = beta - 1.96*sqrt(varb2 + varb12 + 2*covb2b12) in 5
replace ci_h = beta + 1.96*sqrt(varb2 + varb12 + 2*covb2b12) in 5
* inc3tax3 in 6
replace beta=b3 + b15 in 6
replace ci_l = beta - 1.96*sqrt(varb3 + varb15 + 2*covb3b15) in 6
replace ci_h = beta + 1.96*sqrt(varb3 + varb15 + 2*covb3b15) in 6
* tax2inc1 in 7
replace beta=b5 in 7
replace ci_l = beta - 1.96*sqrt(varb5) in 7
replace ci_h = beta + 1.96*sqrt(varb5) in 7
* tax3inc1 in 8
replace beta=b6 in 8 
replace ci_l = beta - 1.96*sqrt(varb6) in 8
replace ci_h = beta + 1.96*sqrt(varb6) in 8
* tax2inc2 in 9
replace beta=b5 + b11 in 9
replace ci_l = beta - 1.96*sqrt(varb5 + varb11 + 2*covb5b11) in 9
replace ci_h = beta + 1.96*sqrt(varb5 + varb11 + 2*covb5b11) in 9
* tax3inc2 in 10
replace beta=b6 + b12 in 10
replace ci_l = beta - 1.96*sqrt(varb6 + varb12 + 2*covb6b12) in 10
replace ci_h = beta + 1.96*sqrt(varb6 + varb12 + 2*covb6b12) in 10
* tax2inc3 in 11
replace beta=b5 + b14 in 11
replace ci_l = beta - 1.96*sqrt(varb5 + varb14 + 2*covb5b14) in 11
replace ci_h = beta + 1.96*sqrt(varb5 + varb14 + 2*covb5b14) in 11
* tax3inc3 in 12
replace beta=b6 + b15 in 12
replace ci_l = beta - 1.96*sqrt(varb6 + varb15 + 2*covb6b15) in 12
replace ci_h = beta + 1.96*sqrt(varb6 + varb15 + 2*covb6b15) in 12

eclplot beta ci_l ci_h MVZ in 1/12, estopts(msize(small)) rplottype(rspike) ciopts(msize(small)) graphregion(fcolor(white)) hor ysca(noline) xline(0, lpattern(dot) lcolor(black) lwidth(medthin)) ///
xlabel(-.2 "-0.2" -.1 "-0.1" 0 "0" .1 "0.1" .2 "0.2", noticks labsize(2)) xtitle("", size(2)) ytitle("") ///
text(0.5 0 "{it:More tax and spend}", place(c) just(center) size(2)) ///
text(2.5 0 "{it:Constant tax and spend}", place(c) just(center) size(2)) ///
text(4.5 0 "{it:Less tax and spend}", place(c) just(center) size(2)) ///
text(6.5 0 "{it:Low income}", place(c) just(center) size(2)) ///
text(8.5 0 "{it:Middle income}", place(c) just(center) size(2)) ///
text(10.5 0 "{it:High income}", place(c) just(center) size(2)) ///
ylabel(1 "Middle income" 2 "High income" 3 "Middle income" 4 "High income" 5 "Middle income" 6 "High income" ///
7 "Constant tax-spend" 8 "Less tax-spend" 9 "Constant tax-spend" 10 "Less tax-spend" 11 "Constant tax-spend" 12 "Less tax-spend", noticks labsize(2)) ///
 saving(ACME_inctax, replace)

***** AMCE interaction INCOME * SAMESEX
use data.dta, clear
tab income samesex
reg Y i.income##i.samesex pol_interest left_right gender age italian ftstudent lyceum edu_imp inc_imp hon_imp taxspend_imp samesex_imp survey, cl(IDContatto)
matrix b=e(b)
matrix V=e(V)
scalar b2=b[1,2]
scalar b3=b[1,3]
scalar b5=b[1,5]
scalar b6=b[1,6]
scalar b11=b[1,11]
scalar b12=b[1,12]
scalar b14=b[1,14]
scalar b15=b[1,15]
scalar list b2 b3 b5 b6 b11 b12 b14 b15

scalar varb2=V[2,2]
scalar varb3=V[3,3]
scalar varb5=V[5,5]
scalar varb6=V[6,6]
scalar varb11=V[11,11]
scalar varb12=V[12,12]
scalar varb14=V[14,14]
scalar varb15=V[15,15]

scalar covb2b3=V[2,3]
scalar covb2b5=V[2,5]
scalar covb2b6=V[2,6]
scalar covb2b11=V[2,11]
scalar covb2b12=V[2,12]
scalar covb2b14=V[2,14]
scalar covb2b15=V[2,15]

scalar covb3b5=V[3,5]
scalar covb3b6=V[3,6]
scalar covb3b11=V[3,11]
scalar covb3b12=V[3,12]
scalar covb3b14=V[3,14]
scalar covb3b15=V[3,15]

scalar covb5b6=V[5,6]
scalar covb5b11=V[5,11]
scalar covb5b12=V[5,12]
scalar covb5b14=V[5,14]
scalar covb5b15=V[5,15]

scalar covb6b11=V[6,11]
scalar covb6b12=V[6,12]
scalar covb6b14=V[6,14]
scalar covb6b15=V[6,15]

scalar covb11b12=V[11,12]
scalar covb11b14=V[11,14]
scalar covb11b15=V[11,15]

scalar covb12b14=V[12,14]
scalar covb12b15=V[12,15]

scalar covb14b15=V[14,15]

scalar list varb2 varb3 varb5 varb6 varb11 varb12 varb14 varb15 covb2b3 covb2b5 covb2b6 covb2b11 covb2b12 covb2b14 covb2b15 ///
covb3b5 covb3b6 covb3b11 covb3b12 covb3b14 covb3b15 covb5b6 covb5b11 covb5b12 covb5b14 covb5b15 covb6b11 covb6b12 covb6b14 covb6b15 ///
covb11b12 covb11b14 covb11b15 covb12b14 covb12b15 covb14b15

parmest, label norestore

generate MVZ=_n
replace MVZ=. if _n>12

* inc2ssex1 in 1
gen beta=b2 in 1
gen ci_l = beta - 1.96*sqrt(varb2) in 1
gen ci_h = beta + 1.96*sqrt(varb2) in 1
* inc3ssex1 in 2
replace beta=b3 in 2 
replace ci_l = beta - 1.96*sqrt(varb3) in 2
replace ci_h = beta + 1.96*sqrt(varb3) in 2
* inc2ssex2 in 3
replace beta=b2 + b11 in 3
replace ci_l = beta - 1.96*sqrt(varb2 + varb11 + 2*covb2b11) in 3
replace ci_h = beta + 1.96*sqrt(varb2 + varb11 + 2*covb2b11) in 3
* inc3ssex2 in 4
replace beta=b3 + b14 in 4
replace ci_l = beta - 1.96*sqrt(varb3 + varb14 + 2*covb3b14) in 4
replace ci_h = beta + 1.96*sqrt(varb3 + varb14 + 2*covb3b14) in 4
* inc2ssex3 in 5
replace beta=b2 + b12 in 5
replace ci_l = beta - 1.96*sqrt(varb2 + varb12 + 2*covb2b12) in 5
replace ci_h = beta + 1.96*sqrt(varb2 + varb12 + 2*covb2b12) in 5
* inc3ssex3 in 6
replace beta=b3 + b15 in 6
replace ci_l = beta - 1.96*sqrt(varb3 + varb15 + 2*covb3b15) in 6
replace ci_h = beta + 1.96*sqrt(varb3 + varb15 + 2*covb3b15) in 6
* ssex2inc1 in 7
replace beta=b5 in 7
replace ci_l = beta - 1.96*sqrt(varb5) in 7
replace ci_h = beta + 1.96*sqrt(varb5) in 7
* ssex3inc1 in 8
replace beta=b6 in 8 
replace ci_l = beta - 1.96*sqrt(varb6) in 8
replace ci_h = beta + 1.96*sqrt(varb6) in 8
* ssex2inc2 in 9
replace beta=b5 + b11 in 9
replace ci_l = beta - 1.96*sqrt(varb5 + varb11 + 2*covb5b11) in 9
replace ci_h = beta + 1.96*sqrt(varb5 + varb11 + 2*covb5b11) in 9
* ssex3inc2 in 10
replace beta=b6 + b12 in 10
replace ci_l = beta - 1.96*sqrt(varb6 + varb12 + 2*covb6b12) in 10
replace ci_h = beta + 1.96*sqrt(varb6 + varb12 + 2*covb6b12) in 10
* ssex2inc3 in 11
replace beta=b5 + b14 in 11
replace ci_l = beta - 1.96*sqrt(varb5 + varb14 + 2*covb5b14) in 11
replace ci_h = beta + 1.96*sqrt(varb5 + varb14 + 2*covb5b14) in 11
* ssex3inc3 in 12
replace beta=b6 + b15 in 12
replace ci_l = beta - 1.96*sqrt(varb6 + varb15 + 2*covb6b15) in 12
replace ci_h = beta + 1.96*sqrt(varb6 + varb15 + 2*covb6b15) in 12

eclplot beta ci_l ci_h MVZ in 1/12, estopts(msize(small)) rplottype(rspike) ciopts(msize(small)) graphregion(fcolor(white)) hor ysca(noline) xline(0, lpattern(dot) lcolor(black) lwidth(medthin)) ///
xlabel(-.7 "-0.7" -.6 "-0.6" -.5 "-0.5" -.4 "-0.4" -.3 "-0.3" -.2 "-0.2" -.1 "-0.1" 0 "0" .1 "0.1" .2 "0.2" .3 "0.3" .4 "0.4" .5 "0.5" .6 "0.6", noticks labsize(2)) xtitle("", size(2)) ytitle("") ///
text(0.5 0 "{it:Same rights}", place(c) just(center) size(2)) ///
text(2.5 0 "{it:Some rights}", place(c) just(center) size(2)) ///
text(4.5 0 "{it:No rights}", place(c) just(center) size(2)) ///
text(6.5 0 "{it:Low income}", place(c) just(center) size(2)) ///
text(8.5 0 "{it:Middle income}", place(c) just(center) size(2)) ///
text(10.5 0 "{it:High income}", place(c) just(center) size(2)) ///
ylabel(1 "Middle income" 2 "High income" 3 "Middle income" 4 "High income" 5 "Middle income" 6 "High income" ///
7 "Some rights" 8 "No rights" 9 "Some rights" 10 "No rights" 11 "Some rights" 12 "No rights", noticks labsize(2)) ///
 saving(ACME_incssex, replace)


***** AMCE interaction CORRUPTION * TAXSPEND
use data.dta, clear
tab corruption taxspend
reg Y i.corruption##i.taxspend pol_interest left_right gender age italian ftstudent lyceum edu_imp inc_imp hon_imp taxspend_imp samesex_imp survey, cl(IDContatto)
matrix b=e(b)
matrix V=e(V)
scalar b2=b[1,2]
scalar b3=b[1,3]
scalar b5=b[1,5]
scalar b6=b[1,6]
scalar b11=b[1,11]
scalar b12=b[1,12]
scalar b14=b[1,14]
scalar b15=b[1,15]
scalar list b2 b3 b5 b6 b11 b12 b14 b15

scalar varb2=V[2,2]
scalar varb3=V[3,3]
scalar varb5=V[5,5]
scalar varb6=V[6,6]
scalar varb11=V[11,11]
scalar varb12=V[12,12]
scalar varb14=V[14,14]
scalar varb15=V[15,15]

scalar covb2b3=V[2,3]
scalar covb2b5=V[2,5]
scalar covb2b6=V[2,6]
scalar covb2b11=V[2,11]
scalar covb2b12=V[2,12]
scalar covb2b14=V[2,14]
scalar covb2b15=V[2,15]

scalar covb3b5=V[3,5]
scalar covb3b6=V[3,6]
scalar covb3b11=V[3,11]
scalar covb3b12=V[3,12]
scalar covb3b14=V[3,14]
scalar covb3b15=V[3,15]

scalar covb5b6=V[5,6]
scalar covb5b11=V[5,11]
scalar covb5b12=V[5,12]
scalar covb5b14=V[5,14]
scalar covb5b15=V[5,15]

scalar covb6b11=V[6,11]
scalar covb6b12=V[6,12]
scalar covb6b14=V[6,14]
scalar covb6b15=V[6,15]

scalar covb11b12=V[11,12]
scalar covb11b14=V[11,14]
scalar covb11b15=V[11,15]

scalar covb12b14=V[12,14]
scalar covb12b15=V[12,15]

scalar covb14b15=V[14,15]

scalar list varb2 varb3 varb5 varb6 varb11 varb12 varb14 varb15 covb2b3 covb2b5 covb2b6 covb2b11 covb2b12 covb2b14 covb2b15 ///
covb3b5 covb3b6 covb3b11 covb3b12 covb3b14 covb3b15 covb5b6 covb5b11 covb5b12 covb5b14 covb5b15 covb6b11 covb6b12 covb6b14 covb6b15 ///
covb11b12 covb11b14 covb11b15 covb12b14 covb12b15 covb14b15

parmest, label norestore

generate MVZ=_n
replace MVZ=. if _n>12

* corr2tax1 in 1
gen beta=b2 in 1
gen ci_l = beta - 1.96*sqrt(varb2) in 1
gen ci_h = beta + 1.96*sqrt(varb2) in 1
* corr3tax1 in 2
replace beta=b3 in 2 
replace ci_l = beta - 1.96*sqrt(varb3) in 2
replace ci_h = beta + 1.96*sqrt(varb3) in 2
* corr2tax2 in 3
replace beta=b2 + b11 in 3
replace ci_l = beta - 1.96*sqrt(varb2 + varb11 + 2*covb2b11) in 3
replace ci_h = beta + 1.96*sqrt(varb2 + varb11 + 2*covb2b11) in 3
* corr3tax2 in 4
replace beta=b3 + b14 in 4
replace ci_l = beta - 1.96*sqrt(varb3 + varb14 + 2*covb3b14) in 4
replace ci_h = beta + 1.96*sqrt(varb3 + varb14 + 2*covb3b14) in 4
* corr2tax3 in 5
replace beta=b2 + b12 in 5
replace ci_l = beta - 1.96*sqrt(varb2 + varb12 + 2*covb2b12) in 5
replace ci_h = beta + 1.96*sqrt(varb2 + varb12 + 2*covb2b12) in 5
* corr3tax3 in 6
replace beta=b3 + b15 in 6
replace ci_l = beta - 1.96*sqrt(varb3 + varb15 + 2*covb3b15) in 6
replace ci_h = beta + 1.96*sqrt(varb3 + varb15 + 2*covb3b15) in 6
* tax2corr1 in 7
replace beta=b5 in 7
replace ci_l = beta - 1.96*sqrt(varb5) in 7
replace ci_h = beta + 1.96*sqrt(varb5) in 7
* tax3corr1 in 8
replace beta=b6 in 8 
replace ci_l = beta - 1.96*sqrt(varb6) in 8
replace ci_h = beta + 1.96*sqrt(varb6) in 8
* tax2corr2 in 9
replace beta=b5 + b11 in 9
replace ci_l = beta - 1.96*sqrt(varb5 + varb11 + 2*covb5b11) in 9
replace ci_h = beta + 1.96*sqrt(varb5 + varb11 + 2*covb5b11) in 9
* tax3corr2 in 10
replace beta=b6 + b12 in 10
replace ci_l = beta - 1.96*sqrt(varb6 + varb12 + 2*covb6b12) in 10
replace ci_h = beta + 1.96*sqrt(varb6 + varb12 + 2*covb6b12) in 10
* tax2corr3 in 11
replace beta=b5 + b14 in 11
replace ci_l = beta - 1.96*sqrt(varb5 + varb14 + 2*covb5b14) in 11
replace ci_h = beta + 1.96*sqrt(varb5 + varb14 + 2*covb5b14) in 11
* tax3corr3 in 12
replace beta=b6 + b15 in 12
replace ci_l = beta - 1.96*sqrt(varb6 + varb15 + 2*covb6b15) in 12
replace ci_h = beta + 1.96*sqrt(varb6 + varb15 + 2*covb6b15) in 12

eclplot beta ci_l ci_h MVZ in 1/12, estopts(msize(small)) rplottype(rspike) ciopts(msize(small)) graphregion(fcolor(white)) hor ysca(noline) xline(0, lpattern(dot) lcolor(black) lwidth(medthin)) ///
xlabel(-.7 "-0.7" -.6 "-0.6" -.5 "-0.5" -.4 "-0.4" -.3 "-0.3" -.2 "-0.2" -.1 "-0.1" 0 "0" .1 "0.1" .2 "0.2", noticks labsize(2)) xtitle("", size(2)) ytitle("") ///
text(0.5 0 "{it:More tax and spend}", place(c) just(center) size(2)) ///
text(2.5 0 "{it:Constant tax and spend}", place(c) just(center) size(2)) ///
text(4.5 0 "{it:Less tax and spend}", place(c) just(center) size(2)) ///
text(6.5 0 "{it:Clean}", place(c) just(center) size(2)) ///
text(8.5 0 "{it:Investigated}", place(c) just(center) size(2)) ///
text(10.5 0 "{it:Corrupt}", place(c) just(center) size(2)) ///
ylabel(1 "Investigated" 2 "Corrupt" 3 "Investigated" 4 "Corrupt" 5 "Investigated" 6 "Corrupt" ///
7 "Constant tax-spend" 8 "Less tax-spend" 9 "Constant tax-spend" 10 "Less tax-spend" 11 "Constant tax-spend" 12 "Less tax-spend", noticks labsize(2)) ///
 saving(ACME_corrtax, replace)


***** AMCE interaction CORRUPTION * SAMESEX
use data.dta, clear
tab corruption samesex
reg Y i.corruption##i.samesex pol_interest left_right gender age italian ftstudent lyceum edu_imp inc_imp hon_imp taxspend_imp samesex_imp survey, cl(IDContatto)
matrix b=e(b)
matrix V=e(V)
scalar b2=b[1,2]
scalar b3=b[1,3]
scalar b5=b[1,5]
scalar b6=b[1,6]
scalar b11=b[1,11]
scalar b12=b[1,12]
scalar b14=b[1,14]
scalar b15=b[1,15]
scalar list b2 b3 b5 b6 b11 b12 b14 b15

scalar varb2=V[2,2]
scalar varb3=V[3,3]
scalar varb5=V[5,5]
scalar varb6=V[6,6]
scalar varb11=V[11,11]
scalar varb12=V[12,12]
scalar varb14=V[14,14]
scalar varb15=V[15,15]

scalar covb2b3=V[2,3]
scalar covb2b5=V[2,5]
scalar covb2b6=V[2,6]
scalar covb2b11=V[2,11]
scalar covb2b12=V[2,12]
scalar covb2b14=V[2,14]
scalar covb2b15=V[2,15]

scalar covb3b5=V[3,5]
scalar covb3b6=V[3,6]
scalar covb3b11=V[3,11]
scalar covb3b12=V[3,12]
scalar covb3b14=V[3,14]
scalar covb3b15=V[3,15]

scalar covb5b6=V[5,6]
scalar covb5b11=V[5,11]
scalar covb5b12=V[5,12]
scalar covb5b14=V[5,14]
scalar covb5b15=V[5,15]

scalar covb6b11=V[6,11]
scalar covb6b12=V[6,12]
scalar covb6b14=V[6,14]
scalar covb6b15=V[6,15]

scalar covb11b12=V[11,12]
scalar covb11b14=V[11,14]
scalar covb11b15=V[11,15]

scalar covb12b14=V[12,14]
scalar covb12b15=V[12,15]

scalar covb14b15=V[14,15]

scalar list varb2 varb3 varb5 varb6 varb11 varb12 varb14 varb15 covb2b3 covb2b5 covb2b6 covb2b11 covb2b12 covb2b14 covb2b15 ///
covb3b5 covb3b6 covb3b11 covb3b12 covb3b14 covb3b15 covb5b6 covb5b11 covb5b12 covb5b14 covb5b15 covb6b11 covb6b12 covb6b14 covb6b15 ///
covb11b12 covb11b14 covb11b15 covb12b14 covb12b15 covb14b15

parmest, label norestore

generate MVZ=_n
replace MVZ=. if _n>12

* corr2ssex1 in 1
gen beta=b2 in 1
gen ci_l = beta - 1.96*sqrt(varb2) in 1
gen ci_h = beta + 1.96*sqrt(varb2) in 1
* corr3ssex1 in 2
replace beta=b3 in 2 
replace ci_l = beta - 1.96*sqrt(varb3) in 2
replace ci_h = beta + 1.96*sqrt(varb3) in 2
* corr2ssex2 in 3
replace beta=b2 + b11 in 3
replace ci_l = beta - 1.96*sqrt(varb2 + varb11 + 2*covb2b11) in 3
replace ci_h = beta + 1.96*sqrt(varb2 + varb11 + 2*covb2b11) in 3
* corr3ssex2 in 4
replace beta=b3 + b14 in 4
replace ci_l = beta - 1.96*sqrt(varb3 + varb14 + 2*covb3b14) in 4
replace ci_h = beta + 1.96*sqrt(varb3 + varb14 + 2*covb3b14) in 4
* corr2ssex3 in 5
replace beta=b2 + b12 in 5
replace ci_l = beta - 1.96*sqrt(varb2 + varb12 + 2*covb2b12) in 5
replace ci_h = beta + 1.96*sqrt(varb2 + varb12 + 2*covb2b12) in 5
* corr3ssex3 in 6
replace beta=b3 + b15 in 6
replace ci_l = beta - 1.96*sqrt(varb3 + varb15 + 2*covb3b15) in 6
replace ci_h = beta + 1.96*sqrt(varb3 + varb15 + 2*covb3b15) in 6
* ssex2corr1 in 7
replace beta=b5 in 7
replace ci_l = beta - 1.96*sqrt(varb5) in 7
replace ci_h = beta + 1.96*sqrt(varb5) in 7
* ssex3corr1 in 8
replace beta=b6 in 8 
replace ci_l = beta - 1.96*sqrt(varb6) in 8
replace ci_h = beta + 1.96*sqrt(varb6) in 8
* ssex2corr2 in 9
replace beta=b5 + b11 in 9
replace ci_l = beta - 1.96*sqrt(varb5 + varb11 + 2*covb5b11) in 9
replace ci_h = beta + 1.96*sqrt(varb5 + varb11 + 2*covb5b11) in 9
* ssex3corr2 in 10
replace beta=b6 + b12 in 10
replace ci_l = beta - 1.96*sqrt(varb6 + varb12 + 2*covb6b12) in 10
replace ci_h = beta + 1.96*sqrt(varb6 + varb12 + 2*covb6b12) in 10
* ssex2corr3 in 11
replace beta=b5 + b14 in 11
replace ci_l = beta - 1.96*sqrt(varb5 + varb14 + 2*covb5b14) in 11
replace ci_h = beta + 1.96*sqrt(varb5 + varb14 + 2*covb5b14) in 11
* ssex3corr3 in 12
replace beta=b6 + b15 in 12
replace ci_l = beta - 1.96*sqrt(varb6 + varb15 + 2*covb6b15) in 12
replace ci_h = beta + 1.96*sqrt(varb6 + varb15 + 2*covb6b15) in 12

eclplot beta ci_l ci_h MVZ in 1/12, estopts(msize(small)) rplottype(rspike) ciopts(msize(small)) graphregion(fcolor(white)) hor ysca(noline) xline(0, lpattern(dot) lcolor(black) lwidth(medthin)) ///
xlabel(-.6 "-0.6" -.5 "-0.5" -.4 "-0.4" -.3 "-0.3" -.2 "-0.2" -.1 "-0.1" 0 "0" .1 "0.1", noticks labsize(2)) xtitle("", size(2)) ytitle("") ///
text(0.5 0 "{it:Same rights}", place(c) just(center) size(2)) ///
text(2.5 0 "{it:Some rights}", place(c) just(center) size(2)) ///
text(4.5 0 "{it:No rights}", place(c) just(center) size(2)) ///
text(6.5 0 "{it:Clean}", place(c) just(center) size(2)) ///
text(8.5 0 "{it:Investigated}", place(c) just(center) size(2)) ///
text(10.5 0 "{it:Corrupt}", place(c) just(center) size(2)) ///
ylabel(1 "Investigated" 2 "Corrupt" 3 "Investigated" 4 "Corrupt" 5 "Investigated" 6 "Corrupt" ///
7 "Some rights" 8 "No rights" 9 "Some rights" 10 "No rights" 11 "Some rights" 12 "No rights", noticks labsize(2)) ///
 saving(ACME_corrssex, replace)

***** AMCE interaction TAXSPEND * SAMESEX
use data.dta, clear
tab taxspend samesex
reg Y i.taxspend##i.samesex pol_interest left_right gender age italian ftstudent lyceum edu_imp inc_imp hon_imp taxspend_imp samesex_imp survey, cl(IDContatto)
matrix b=e(b)
matrix V=e(V)
scalar b2=b[1,2]
scalar b3=b[1,3]
scalar b5=b[1,5]
scalar b6=b[1,6]
scalar b11=b[1,11]
scalar b12=b[1,12]
scalar b14=b[1,14]
scalar b15=b[1,15]
scalar list b2 b3 b5 b6 b11 b12 b14 b15

scalar varb2=V[2,2]
scalar varb3=V[3,3]
scalar varb5=V[5,5]
scalar varb6=V[6,6]
scalar varb11=V[11,11]
scalar varb12=V[12,12]
scalar varb14=V[14,14]
scalar varb15=V[15,15]

scalar covb2b3=V[2,3]
scalar covb2b5=V[2,5]
scalar covb2b6=V[2,6]
scalar covb2b11=V[2,11]
scalar covb2b12=V[2,12]
scalar covb2b14=V[2,14]
scalar covb2b15=V[2,15]

scalar covb3b5=V[3,5]
scalar covb3b6=V[3,6]
scalar covb3b11=V[3,11]
scalar covb3b12=V[3,12]
scalar covb3b14=V[3,14]
scalar covb3b15=V[3,15]

scalar covb5b6=V[5,6]
scalar covb5b11=V[5,11]
scalar covb5b12=V[5,12]
scalar covb5b14=V[5,14]
scalar covb5b15=V[5,15]

scalar covb6b11=V[6,11]
scalar covb6b12=V[6,12]
scalar covb6b14=V[6,14]
scalar covb6b15=V[6,15]

scalar covb11b12=V[11,12]
scalar covb11b14=V[11,14]
scalar covb11b15=V[11,15]

scalar covb12b14=V[12,14]
scalar covb12b15=V[12,15]

scalar covb14b15=V[14,15]

scalar list varb2 varb3 varb5 varb6 varb11 varb12 varb14 varb15 covb2b3 covb2b5 covb2b6 covb2b11 covb2b12 covb2b14 covb2b15 ///
covb3b5 covb3b6 covb3b11 covb3b12 covb3b14 covb3b15 covb5b6 covb5b11 covb5b12 covb5b14 covb5b15 covb6b11 covb6b12 covb6b14 covb6b15 ///
covb11b12 covb11b14 covb11b15 covb12b14 covb12b15 covb14b15

parmest, label norestore

generate MVZ=_n
replace MVZ=. if _n>12

* tax2ssex1 in 1
gen beta=b2 in 1
gen ci_l = beta - 1.96*sqrt(varb2) in 1
gen ci_h = beta + 1.96*sqrt(varb2) in 1
* tax3ssex1 in 2
replace beta=b3 in 2 
replace ci_l = beta - 1.96*sqrt(varb3) in 2
replace ci_h = beta + 1.96*sqrt(varb3) in 2
* tax2ssex2 in 3
replace beta=b2 + b11 in 3
replace ci_l = beta - 1.96*sqrt(varb2 + varb11 + 2*covb2b11) in 3
replace ci_h = beta + 1.96*sqrt(varb2 + varb11 + 2*covb2b11) in 3
* tax3ssex2 in 4
replace beta=b3 + b14 in 4
replace ci_l = beta - 1.96*sqrt(varb3 + varb14 + 2*covb3b14) in 4
replace ci_h = beta + 1.96*sqrt(varb3 + varb14 + 2*covb3b14) in 4
* tax2ssex3 in 5
replace beta=b2 + b12 in 5
replace ci_l = beta - 1.96*sqrt(varb2 + varb12 + 2*covb2b12) in 5
replace ci_h = beta + 1.96*sqrt(varb2 + varb12 + 2*covb2b12) in 5
* tax3ssex3 in 6
replace beta=b3 + b15 in 6
replace ci_l = beta - 1.96*sqrt(varb3 + varb15 + 2*covb3b15) in 6
replace ci_h = beta + 1.96*sqrt(varb3 + varb15 + 2*covb3b15) in 6
* ssex2tax1 in 7
replace beta=b5 in 7
replace ci_l = beta - 1.96*sqrt(varb5) in 7
replace ci_h = beta + 1.96*sqrt(varb5) in 7
* ssex3tax1 in 8
replace beta=b6 in 8 
replace ci_l = beta - 1.96*sqrt(varb6) in 8
replace ci_h = beta + 1.96*sqrt(varb6) in 8
* ssex2tax2 in 9
replace beta=b5 + b11 in 9
replace ci_l = beta - 1.96*sqrt(varb5 + varb11 + 2*covb5b11) in 9
replace ci_h = beta + 1.96*sqrt(varb5 + varb11 + 2*covb5b11) in 9
* ssex3tax2 in 10
replace beta=b6 + b12 in 10
replace ci_l = beta - 1.96*sqrt(varb6 + varb12 + 2*covb6b12) in 10
replace ci_h = beta + 1.96*sqrt(varb6 + varb12 + 2*covb6b12) in 10
* ssex2tax3 in 11
replace beta=b5 + b14 in 11
replace ci_l = beta - 1.96*sqrt(varb5 + varb14 + 2*covb5b14) in 11
replace ci_h = beta + 1.96*sqrt(varb5 + varb14 + 2*covb5b14) in 11
* ssex3tax3 in 12
replace beta=b6 + b15 in 12
replace ci_l = beta - 1.96*sqrt(varb6 + varb15 + 2*covb6b15) in 12
replace ci_h = beta + 1.96*sqrt(varb6 + varb15 + 2*covb6b15) in 12

eclplot beta ci_l ci_h MVZ in 1/12, estopts(msize(small)) rplottype(rspike) ciopts(msize(small)) graphregion(fcolor(white)) hor ysca(noline) xline(0, lpattern(dot) lcolor(black) lwidth(medthin)) ///
xlabel(-.3 "-0.3" -.2 "-0.2" -.1 "-0.1" 0 "0" .1 "0.1", noticks labsize(2)) xtitle("", size(2)) ytitle("") ///
text(0.5 0 "{it:Same rights}", place(c) just(center) size(2)) ///
text(2.5 0 "{it:Some rights}", place(c) just(center) size(2)) ///
text(4.5 0 "{it:No rights}", place(c) just(center) size(2)) ///
text(6.5 0 "{it:More tax and spend}", place(c) just(center) size(2)) ///
text(8.5 0 "{it:Constant tax and spend}", place(c) just(center) size(2)) ///
text(10.5 0 "{it:Less tax and spend}", place(c) just(center) size(2)) ///
ylabel(1 "Constant tax-spend" 2 "Less tax-spend" 3 "Constant tax-spend" 4 "Less tax-spend" 5 "Constant tax-spend" 6 "Less tax-spend" ///
7 "Some rights" 8 "No rights" 9 "Some rights" 10 "No rights" 11 "Some rights" 12 "No rights", noticks labsize(2)) ///
 saving(ACME_taxssex, replace)

graph combine ACME_noint.gph ACME_eduinc.gph ACME_educorr.gph ACME_edutax.gph, ///
imargin(0 0 0 0) graphregion(fcolor(white)) saving(Figure_A12u, replace) cols(2)

graph combine ACME_edussex.gph ACME_inccorr.gph ACME_inctax.gph ACME_incssex.gph, ///
imargin(0 0 0 0) graphregion(fcolor(white)) saving(Figure_A12m, replace) cols(2)

graph combine ACME_corrtax.gph ACME_corrssex.gph ACME_taxssex.gph, ///
imargin(0 0 0 0) graphregion(fcolor(white)) saving(Figure_A12l, replace) cols(2)

exit
